#pragma once
#include <memory>
#include <vector>

class EventLoop;
class EventLoopThread;

/// I/O 线程池，每个线程运行一个 EventLoop
class EventLoopThreadPool {
public:
    EventLoopThreadPool(EventLoop& baseLoop, int numThreads);
    ~EventLoopThreadPool();

    void start();
    EventLoop& getNextLoop();  // 轮询选择下一个 EventLoop

private:
    EventLoop& baseLoop_;
    int numThreads_;
    bool started_{false};
    int next_{0};
    std::vector<std::unique_ptr<EventLoopThread>> threads_;
    std::vector<EventLoop*> loops_;
};